package cn.com.headfree.drafts.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import cn.com.headfree.entity.*;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.gta.edu.sdk.common.dto.Page;
import com.gta.edu.sdk.util.IdGen;
import com.gta.edu.sdk.util.StringUtil;

import cn.com.headfree.base.controller.ExBaseController;
import cn.com.headfree.base.controller.ResultData;
import cn.com.headfree.depterprela.service.IDeptErpRelaService;
import cn.com.headfree.drafts.service.IDraftsService;
import cn.com.headfree.entity.isc.User;
import cn.com.headfree.userinfo.service.IUserInfoService;
import cn.com.headfree.util.GetFullDeptByErpNoUtil;
import cn.com.headfree.util.SysDictionaryUtil;
import cn.com.headfree.vo.CommonVo;
import cn.com.headfree.vo.DeptIdPathVo;
import cn.com.headfree.vo.complex.TAcadeAchiveInfoVo;
import cn.com.headfree.vo.complex.TPatentInfoVo;
import cn.com.headfree.vo.complex.TProjAchieveInfoVo;
import cn.com.headfree.vo.complex.TStandInfoVo;
import cn.com.headfree.vo.complex.TTecInnovInfoVo;
import cn.com.headfree.vo.complex.TTecManInnovVo;
import cn.com.headfree.vo.drafts.DraftsListVo;

@Controller
@RequestMapping(value = "/drafts", produces = "application/json;charset=UTF-8")
public class DraftsController extends ExBaseController {

    private static final Logger LOG = LogManager.getLogger(DraftsController.class);

    @Autowired
    private IDraftsService draftsService;

    @Autowired
    public IUserInfoService userInfoService;

    @Autowired
    private IDeptErpRelaService deptErpRelaService;

    /**
     * 查询个人资料概览种类信息
     *
     * @param tMouldInfo
     * @return
     */
    @RequestMapping("/getMouldInfoList")
    @ResponseBody
    public ResultData getMouldInfoList(TMouldInfo tMouldInfo) {
        ResultData rs = new ResultData();
        try {
            List<TMouldInfo> list = draftsService.getMouldInfoList(tMouldInfo);
            rs.setData(list);
            LOG.info("查询个人分类信息成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查询个人分类信息失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 添加年度绩效
     *
     * @param yearEffectInfo
     * @return
     */
    @RequestMapping("/addYearEffect")
    @ResponseBody
    public ResultData addYearEffect(TYearEffectInfo yearEffectInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addYearEffect(yearEffectInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("年度绩效添加成功！");
                LOG.info("年度绩效添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(yearEffectInfo.getId());
            draftsList.setTypeId(yearEffectInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(yearEffectInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("年度绩效添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/addEducateInfo")
    @ResponseBody
    public ResultData addEducateInfo(TEducateInfo tEducateInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addEducateInfo(tEducateInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("学历信息添加成功！");
                LOG.info("学历信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tEducateInfo.getId());
            draftsList.setTypeId(tEducateInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tEducateInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("学历信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加继续教育经历、培训经历、授课经历
     *
     * @param tContiStudyInfo
     * @return
     */
    @RequestMapping("/addContiStudyInfo")
    @ResponseBody
    public ResultData addContiStudyInfo(TContiStudyInfo tContiStudyInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addContiStudyInfo(tContiStudyInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("培训及授课经历添加成功！");
                LOG.info("培训及授课经历添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tContiStudyInfo.getId());
            draftsList.setTypeId(tContiStudyInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tContiStudyInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("培训及授课经历添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加专业技术资格信息
     *
     * @param
     * @return
     */
    @RequestMapping("/addProTecInfo")
    @ResponseBody
    public ResultData addProTecInfo(TProTecInfo tProTecInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addProTecInfo(tProTecInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("专业技术资格信息添加成功！");
                LOG.info("专业技术资格信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tProTecInfo.getId());
            draftsList.setTypeId(tProTecInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tProTecInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专业技术资格信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加技能等级信息
     *
     * @param tSkillLevelInfo
     * @return
     */
    @RequestMapping("/addSkillLevelInfo")
    @ResponseBody
    public ResultData addSkillLevelInfo(TSkillLevelInfo tSkillLevelInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addSkillLevelInfo(tSkillLevelInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("技能等级信息添加成功！");
                LOG.info("技能等级信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tSkillLevelInfo.getId());
            draftsList.setTypeId(tSkillLevelInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tSkillLevelInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("技能等级信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加专家人才称号信息
     *
     * @param tExpertTitleInfo
     * @return
     */
    @RequestMapping("/addExpertTitleInfo")
    @ResponseBody
    public ResultData addExpertTitleInfo(TExpertTitleInfo tExpertTitleInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addExpertTitleInfo(tExpertTitleInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("专家人才称号信息添加成功！");
                LOG.info("专家人才称号信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tExpertTitleInfo.getId());
            draftsList.setTypeId(tExpertTitleInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tExpertTitleInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专家人才称号信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加学术成果
     *
     * @param tAcadeAchiveInfo
     * @return
     */
    @RequestMapping("/addAcadeAchiveInfo")
    @ResponseBody
    public ResultData addAcadeAchiveInfo(@RequestBody TAcadeAchiveInfo tAcadeAchiveInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addAcadeAchiveInfo(tAcadeAchiveInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("学术成果添加成功！");
                LOG.info("学术成果添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tAcadeAchiveInfo.getId());
            draftsList.setTypeId(tAcadeAchiveInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tAcadeAchiveInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("学术成果添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加制度标准
     *
     * @param tStandInfo
     * @return
     */
    @RequestMapping("/addStandInfo")
    @ResponseBody
    public ResultData addStandInfo(@RequestBody TStandInfo tStandInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addStandInfo(tStandInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("制度标准添加成功！");
                LOG.info("制度标准添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tStandInfo.getId());
            draftsList.setTypeId(tStandInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tStandInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("制度标准添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加专利
     *
     * @param tPatentInfo
     * @return
     */
    @RequestMapping("/addPatentInfo")
    @ResponseBody
    public ResultData addPatentInfo(@RequestBody TPatentInfo tPatentInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addPatentInfo(tPatentInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("专利添加成功！");
                LOG.info("专利添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tPatentInfo.getId());
            draftsList.setTypeId(tPatentInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tPatentInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专利添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加技艺革新信息
     *
     * @param tTecInnovInfo
     * @return
     */
    @RequestMapping("/addTecInnovInfo")
    @ResponseBody
    public ResultData addTecInnovInfo(@RequestBody TTecInnovInfo tTecInnovInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addTecInnovInfo(tTecInnovInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("技艺革新信息添加成功！");
                LOG.info("技艺革新信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tTecInnovInfo.getId());
            draftsList.setTypeId(tTecInnovInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tTecInnovInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("技艺革新信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加竞赛考试
     *
     * @param tContestInfo
     * @return
     */
    @RequestMapping("/addContestInfo")
    @ResponseBody
    public ResultData addContestInfo(TContestInfo tContestInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addContestInfo(tContestInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("竞赛考试添加成功！");
                LOG.info("竞赛考试添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tContestInfo.getId());
            draftsList.setTypeId(tContestInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tContestInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("竞赛考试添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加科技及管理、创新成果
     *
     * @param tTecManInnov
     * @return
     */
    @RequestMapping("/addTecManInnov")
    @ResponseBody
    public ResultData addTecManInnov(@RequestBody TTecManInnov tTecManInnov, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addTecManInnov(tTecManInnov, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("科技及管理、创新成果添加成功！");
                LOG.info("科技及管理、创新成果添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tTecManInnov.getId());
            draftsList.setTypeId(tTecManInnov.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tTecManInnov.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("科技及管理、创新成果添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加个人荣誉信息
     *
     * @param tHonorInfo
     * @return
     */
    @RequestMapping("/addHonorInfo")
    @ResponseBody
    public ResultData addHonorInfo(THonorInfo tHonorInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addHonorInfo(tHonorInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("个人荣誉信息添加成功！");
                LOG.info("个人荣誉信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tHonorInfo.getId());
            draftsList.setTypeId(tHonorInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tHonorInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("个人荣誉信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加项目、课题、成果
     *
     * @param
     * @return
     */
    @RequestMapping("/addProjAchieveInfo")
    @ResponseBody
    public ResultData addProjAchieveInfo(@RequestBody TProjAchieveInfo tProjAchieveInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addProjAchieveInfo(tProjAchieveInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("项目课题成果添加成功！");
                LOG.info("项目课题成果添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tProjAchieveInfo.getId());
            draftsList.setTypeId(tProjAchieveInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tProjAchieveInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("项目课题成果添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加导师带徒
     *
     * @param
     * @return
     */
    @RequestMapping("/addSdtTutorPrentInfo")
    @ResponseBody
    public ResultData addSdtTutorPrentInfo(@RequestBody TSdtTutorPrentInfo tSdtTutorPrentInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addSdtTutorPrentInfo(tSdtTutorPrentInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("导师带徒添加成功！");
                LOG.info("导师带徒添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tSdtTutorPrentInfo.getId());
            draftsList.setTypeId(tSdtTutorPrentInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tSdtTutorPrentInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("导师带徒添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加挂职轮岗信息
     *
     * @param tRotationInfo
     * @param request
     * @return ResultData
     * @author yangwang
     */
    @RequestMapping("/addRotationInfo")
    @ResponseBody
    public ResultData addRotationInfo(@RequestBody TRotationInfo tRotationInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            String message = draftsService.addRotationInfo(tRotationInfo, user);
            if (StringUtils.isNotBlank(message)) {
                rs.setSuccess(false);
                rs.setErrorMsg(message);
            } else {
                rs.setData("挂职轮岗信息添加成功！");
                LOG.info("挂职轮岗信息添加成功！");
            }
            //往草稿箱列表添加数据
            DraftsListVo draftsList = new DraftsListVo();
            draftsList.setBusinessId(tRotationInfo.getId());
            draftsList.setTypeId(tRotationInfo.getBusinessTypeId());
            TMouldInfo tMouldInfo = new TMouldInfo();
            tMouldInfo.setId(tRotationInfo.getBusinessTypeId());
            List<TMouldInfo> list = userInfoService.getMouldInfoList(tMouldInfo);
            if (list != null && list.size() > 0) {
                draftsList.setTypeName(list.get(0).getMouldName());
            }
            draftsService.addDraftsList(draftsList, user);
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("挂职轮岗信息添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    private ResultData checkErpNoIsNull(String erpNo) {
        ResultData result = new ResultData();
        if (StringUtils.isEmpty(erpNo)) {
            result.setSuccess(false);
            result.setErrorMsg("ErpNo或记录ID参数为空");
        }
        return result;
    }


    /**
     * 查找学历信息
     *
     * @param page
     * @param tEducateInfo
     * @return
     */
    @RequestMapping("/getPageEducateInfo")
    @ResponseBody
    public ResultData getPageEducateInfo(Page<TEducateInfo> page, @RequestBody TEducateInfo tEducateInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tEducateInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageEducateInfoByCondi(page, tEducateInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setSchoolTypeName(SysDictionaryUtil.getNameByValueForDefault("CollegeCategory", p.getSchoolType()));
                    p.setEducNameName(SysDictionaryUtil.getNameByValueForDefault("PersonnelQualifications", p.getEducName()));
                    p.setDegreeNameName(SysDictionaryUtil.getNameByValueForDefault("AcademicDegree", p.getDegreeName()));
                });
            }
            rs.setData(page);
            LOG.info("查找学历信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学历信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getEducateInfoById")
    @ResponseBody
    public ResultData getEducateInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TEducateInfo tEducateInfo = draftsService.getEducateInfoById(id);
            rs.setData(tEducateInfo);
            LOG.info("查找学历信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学历信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getContiStudyInfoById")
    @ResponseBody
    public ResultData getContiStudyInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TContiStudyInfo tContiStudyInfo = draftsService.getContiStudyInfoById(id);
            rs.setData(tContiStudyInfo);
            LOG.info("查询培训及授课经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查询培训及授课经历失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageContiStudyInfo")
    @ResponseBody
    public ResultData getPageContiStudyInfo(Page<TContiStudyInfo> page, @RequestBody TContiStudyInfo tContiStudyInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tContiStudyInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageContiStudyInfoByCondi(page, tContiStudyInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("PeixunshoukeType", p.getType()));//绩效等级
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("PeixunshoukeLevel", p.getLevel()));// 绩效等级
                });
            }
            rs.setData(page);
            LOG.info("查询培训及授课经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查询培训及授课经历失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getProTecInfoById")
    @ResponseBody
    public ResultData getProTecInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TProTecInfo tProTecInfo = draftsService.getProTecInfoById(id);
            rs.setData(tProTecInfo);
            LOG.info("查找专业技术资格信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专业技术资格信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageProTecInfo")
    @ResponseBody
    public ResultData getPageProTecInfo(Page<TProTecInfo> page, @RequestBody TProTecInfo tProTecInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tProTecInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageProTecInfoByCondi(page, tProTecInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setSubjSetName(SysDictionaryUtil.getNameByValueForDefault("ProTechnicalQualifications", p.getSubjSet()));
                    p.setSubjLevelName(SysDictionaryUtil.getNameByValueForDefault("ProfessionalQualifications", p.getSubjLevel()));
                    p.setOrgLevelName(SysDictionaryUtil.getNameByValueForDefault("IdentificationUnitLevel", p.getOrgLevel()));
                });
            }
            rs.setData(page);
            LOG.info("查找专业技术资格信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专业技术资格信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getSkillLevelInfoById")
    @ResponseBody
    public ResultData getSkillLevelInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TSkillLevelInfo tSkillLevelInfo = draftsService.getSkillLevelInfoById(id);
            rs.setData(tSkillLevelInfo);
            LOG.info("查找技能等级信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技能等级信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageSkillLevelInfo")
    @ResponseBody
    public ResultData getPageSkillLevelInfo(Page<TSkillLevelInfo> page, @RequestBody TSkillLevelInfo tSkillLevelInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tSkillLevelInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageSkillLevelInfoByCondi(page, tSkillLevelInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setTechTypeName(SysDictionaryUtil.getNameByValueForDefault("SkillAppraisalWork", p.getTechType()));
                    p.setQualifiLevelName(SysDictionaryUtil.getNameByValueForDefault("QualificationLevel", p.getQualifiLevel()));
                    p.setOrgLevelName(SysDictionaryUtil.getNameByValueForDefault("IdentificationUnitLevel", p.getOrgLevel()));
                });
            }
            rs.setData(page);
            LOG.info("查找技能等级信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技能等级信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getExpertTitleInfoById")
    @ResponseBody
    public ResultData getExpertTitleInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TExpertTitleInfo tExpertTitleInfo = draftsService.getExpertTitleInfoById(id);
            rs.setData(tExpertTitleInfo);
            LOG.info("查找专家人才称号信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专家人才称号信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageExpertTitleInfo")
    @ResponseBody
    public ResultData getPageExpertTitleInfo(Page<TExpertTitleInfo> page, @RequestBody TExpertTitleInfo tExpertTitleInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tExpertTitleInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageExpertTitleInfoByCondi(page, tExpertTitleInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setMajorName(SysDictionaryUtil.getNameByValueForDefault("ProWorkTypes", p.getMajor()));
                    p.setEmpTitleName(SysDictionaryUtil.getNameByValueForDefault("TalentTitle", p.getEmpTitle()));
                    p.setLevelNameName(SysDictionaryUtil.getNameByValueForDefault("ExpertLevel", p.getLevelName()));
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("ExpertCategory", p.getType()));
                });
            }
            rs.setData(page);
            LOG.info("查找专家人才称号信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专家人才称号信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getAcadeAchiveInfoById")
    @ResponseBody
    public ResultData getAcadeAchiveInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TAcadeAchiveInfoVo tAcadeAchiveInfoVo = draftsService.getAcadeAchiveInfoById(id);
            rs.setData(tAcadeAchiveInfoVo);
            LOG.info("查找学术成果信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学术成果信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageAcadeAchiveInfo")
    @ResponseBody
    public ResultData getPageAcadeAchiveInfo(Page<TAcadeAchiveInfoVo> page, @RequestBody TAcadeAchiveInfo tAcadeAchiveInfo) {
        ResultData rs = new ResultData();
        if (!tAcadeAchiveInfo.gettPartRankList().isEmpty()) {
            rs = checkErpNoIsNull(tAcadeAchiveInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageAcadeAchiveInfoByCondi(page, tAcadeAchiveInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAcadTypeName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoType", p.getAcadType()));
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJb", p.getLevel()));
                });
            }
            rs.setData(page);
            LOG.info("查找学术成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学术成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getStandInfoById")
    @ResponseBody
    public ResultData getStandInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TStandInfoVo tStandInfoVo = draftsService.getStandInfoById(id);
            rs.setData(tStandInfoVo);
            LOG.info("查找制度标准成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找制度标准失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageStandInfoInfo")
    @ResponseBody
    public ResultData getPageStandInfo(Page<TStandInfoVo> page, @RequestBody TStandInfo tStandInfo) {
        ResultData rs = new ResultData();
        if (!tStandInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tStandInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageStandInfoByCondi(page, tStandInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("ZdbzType", p.getType()));
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getLevel()));
                });
            }
            rs.setData(page);
            LOG.info("查找制度标准成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找制度标准失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPatentInfoById")
    @ResponseBody
    public ResultData getPatentInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TPatentInfoVo tPatentInfoVo = draftsService.getPatentInfoById(id);
            rs.setData(tPatentInfoVo);
            LOG.info("查找专利成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专利失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPagePatentInfo")
    @ResponseBody
    public ResultData getPagePatentInfo(Page<TPatentInfoVo> page, @RequestBody TPatentInfo tPatentInfo) {
        ResultData rs = new ResultData();
        if (!tPatentInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tPatentInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPagePatentInfoByCondi(page, tPatentInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setPatentTypeName(SysDictionaryUtil.getNameByValueForDefault("PatentType", p.getPatentType()));
                });
            }
            rs.setData(page);
            LOG.info("查找专利信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专利信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getTecInnovInfoById")
    @ResponseBody
    public ResultData getTecInnovInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TTecInnovInfoVo tTecInnovInfoVo = draftsService.getTecInnovInfoById(id);
            rs.setData(tTecInnovInfoVo);
            LOG.info("查找技艺革新信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技艺革新信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageTecInnovInfo")
    @ResponseBody
    public ResultData getPageTecInnovInfo(Page<TTecInnovInfoVo> page, @RequestBody TTecInnovInfo tTecInnovInfo) {
        ResultData rs = new ResultData();
        if (!tTecInnovInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tTecInnovInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageTecInnovInfoByCondi(page, tTecInnovInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
                    p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
                });
            }
            rs.setData(page);
            LOG.info("查找技艺革新信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技艺革新信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getContestInfoById")
    @ResponseBody
    public ResultData getContestInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TContestInfo tContestInfo = draftsService.getContestInfoById(id);
            rs.setData(tContestInfo);
            LOG.info("查找竞赛考试成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找竞赛考试失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageContestInfo")
    @ResponseBody
    public ResultData getPageContestInfo(Page<TContestInfo> page, @RequestBody TContestInfo tContestInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tContestInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageContestInfoByCondi(page, tContestInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
                    p.setCompRankName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getCompRank()));
                });
            }
            rs.setData(page);
            LOG.info("查找竞赛考试成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找竞赛考试失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getTecManInnovById")
    @ResponseBody
    public ResultData getTecManInnovById(String id) {
        ResultData rs = new ResultData();
        try {
            TTecManInnovVo tTecManInnov = draftsService.getTecManInnovById(id);
            rs.setData(tTecManInnov);
            LOG.info("查找科技及管理、创新成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找科技及管理、创新成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageTecManInnov")
    @ResponseBody
    public ResultData getPageTecManInnov(Page<TTecManInnovVo> page, @RequestBody TTecManInnov tTecManInnov) {
        ResultData rs = new ResultData();
        if (!tTecManInnov.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tTecManInnov.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageTecManInnovByCondi(page, tTecManInnov);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
                    p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
                    p.setAchiTypeName(SysDictionaryUtil.getNameByValueForDefault("KjglAchiveType", p.getAchiType()));
                });
            }
            rs.setData(page);
            LOG.info("查找科技及管理、创新成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找科技及管理、创新成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getHonorInfoById")
    @ResponseBody
    public ResultData getHonorInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            THonorInfo tHonorInfo = draftsService.getHonorInfoById(id);
            rs.setData(tHonorInfo);
            LOG.info("查找个人荣誉信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人荣誉信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageHonorInfo")
    @ResponseBody
    public ResultData getPageHonorInfo(Page<THonorInfo> page, @RequestBody THonorInfo tHonorInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tHonorInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageHonorInfoByCondi(page, tHonorInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setHonorLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getHonorLevel()));
                    p.setHonorTypeName(SysDictionaryUtil.getNameByValueForDefault("RuYuLeiBie", p.getHonorType()));
                });
            }
            rs.setData(page);
            LOG.info("查找个人荣誉信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人荣誉信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getProjAchieveInfoById")
    @ResponseBody
    public ResultData getProjAchieveInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TProjAchieveInfoVo tProjAchieveInfoVo = draftsService.getProjAchieveInfoById(id);
            rs.setData(tProjAchieveInfoVo);
            LOG.info("查找项目课题成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找项目课题成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageProjAchieveInfo")
    @ResponseBody
    public ResultData getPageProjAchieveInfo(Page<TProjAchieveInfoVo> page, @RequestBody TProjAchieveInfo tProjAchieveInfo) {
        ResultData rs = new ResultData();
        if (!tProjAchieveInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tProjAchieveInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageProjAchieveInfoByCondi(page, tProjAchieveInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XiangMuKeTiJS", p.getRole()));
                    p.setProjLevelName(SysDictionaryUtil.getNameByValueForDefault("StandardLevel", p.getProjLevel()));
                });
            }
            rs.setData(page);
            LOG.info("查找项目课题成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找项目课题成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getSdtTutorPrentInfoById")
    @ResponseBody
    public ResultData getSdtTutorPrentInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TSdtTutorPrentInfo tSdtTutorPrentInfo = draftsService.getSdtTutorPrentInfoById(id);
            rs.setData(tSdtTutorPrentInfo);
            LOG.info("查找导师带徒添加成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找导师带徒添加失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageSdtTutorPrentInfo")
    @ResponseBody
    public ResultData getPageSdtTutorPrentInfo(Page<TSdtTutorPrentInfo> page, @RequestBody TSdtTutorPrentInfo tSdtTutorPrentInfo) {

        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tSdtTutorPrentInfo.getErpNo());

        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageSdtTutorPrentInfoByCondi(page, tSdtTutorPrentInfo);

            rs.setData(page);
            LOG.info("查找导师带徒信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找导师带徒信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getWorkExpInfoById")
    @ResponseBody
    public ResultData getWorkExpInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TWorkExpInfo tWorkExpInfo = draftsService.getWorkExpInfoById(id);
            rs.setData(tWorkExpInfo);
            LOG.info("查找工作经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找工作经历失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getPageWorkExp")
    @ResponseBody
    public ResultData getPageWorkExpInfo(Page<TWorkExpInfo> page, @RequestBody TWorkExpInfo tWorkExpInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tWorkExpInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageWorkExpInfoByCondi(page, tWorkExpInfo);
            if (!page.getResult().isEmpty()) {

                page.getResult().forEach(p -> {
                    p.setPostTypeName(SysDictionaryUtil.getNameByValueForDefault("PostCategory", p.getPostType()));//绩效等级
                    p.setRankName(SysDictionaryUtil.getNameByValueForDefault("DutyLevel", p.getRank()));//绩效等级
                });
            }
            rs.setData(page);
            LOG.info("查找工作经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找工作经历失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 获取挂职轮岗分页信息
     *
     * @param page
     * @param tRotationInfo
     * @return ResultData
     * @author yangwang
     */
    @RequestMapping("/getPageRotationInfo")
    @ResponseBody
    public ResultData getPageRotationInfo(Page<TRotationInfo> page, @RequestBody TRotationInfo tRotationInfo) {
        ResultData rs = new ResultData();
        try {
            draftsService.findPageRotationInfoByCondi(page, tRotationInfo);
            rs.setData(page);
            LOG.info("查找挂职轮岗信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找挂职轮岗信息失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 根据id获取挂职轮岗信息
     *
     * @param tRotationInfo
     * @param request
     * @return ResultData
     * @author yangwang
     */
    @RequestMapping("/getRotationInfoById")
    @ResponseBody
    public ResultData getRotationInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            rs.setData(draftsService.getRotationInfoById(id));
            LOG.info("查找挂职轮岗信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找挂职轮岗信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 编辑学历信息
     *
     * @param educateInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateEducateInfo")
    @ResponseBody
    public ResultData updateEducateInfo(TEducateInfo educateInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学历信息
            int flag = draftsService.updateEducateInfoYes(educateInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("学历信息编辑成功！");
            }
            LOG.info("学历信息编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("学历信息编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 教育培训及授课经历编辑
     *
     * @param contiStudyInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateContiStudyInfo")
    @ResponseBody
    public ResultData updateContiStudyInfo(TContiStudyInfo contiStudyInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学历信息
            int flag = draftsService.updateContiStudyInfo(contiStudyInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("教育培训及授课经历编辑成功！");
            }
            LOG.info("教育培训及授课经历编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("教育培训及授课经历编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 专业技术资格编辑
     *
     * @param proTecInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateProTecInfo")
    @ResponseBody
    public ResultData updateProTecInfo(TProTecInfo proTecInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学历信息
            int flag = draftsService.updateProTecInfo(proTecInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("专业技术资格编辑成功！");
            }
            LOG.info("专业技术资格编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专业技术资格编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 技能等级信息编辑
     *
     * @param skillLevelInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateSkillLevelInfo")
    @ResponseBody
    public ResultData updateSkillLevelInfo(TSkillLevelInfo skillLevelInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学历信息
            int flag = draftsService.updateTSkillLevelInfo(skillLevelInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("技能等级信息编辑成功！");
            }
            LOG.info("技能等级信息编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("技能等级信息编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 专家人才称号编辑
     *
     * @param expertTitleInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateExpertTitleInfo")
    @ResponseBody
    public ResultData updateExpertTitleInfo(TExpertTitleInfo expertTitleInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑专家人才称号
            int flag = draftsService.updateTExpertTitleInfo(expertTitleInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("专家人才称号编辑成功！");
            }
            LOG.info("专家人才称号编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专家人才称号编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 编辑学术成果
     *
     * @param acadeAchiveInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTAcadeAchiveInfo")
    @ResponseBody
    public ResultData updateTAcadeAchiveInfo(@RequestBody TAcadeAchiveInfo acadeAchiveInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学术成果
            int flag = draftsService.updateTAcadeAchiveInfo(acadeAchiveInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(acadeAchiveInfo.getId(), acadeAchiveInfo.gettPartRankList(), "12");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("学术成果编辑成功！");
            }
            LOG.info("学术成果编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("学术成果编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 学术成果编辑
     *
     * @param standInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTStandInfo")
    @ResponseBody
    public ResultData updateTStandInfo(@RequestBody TStandInfo standInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑制度标准
            int flag = draftsService.updateTStandInfo(standInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(standInfo.getId(), standInfo.gettPartRankList(), "13");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("编辑制度标准成功！");
            }
            LOG.info("编辑制度标准成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("编辑制度标准失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 编辑专利信息
     *
     * @param patentInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTPatentInfo")
    @ResponseBody
    public ResultData updateTPatentInfo(@RequestBody TPatentInfo patentInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑专利信息
            int flag = draftsService.updateTPatentInfo(patentInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(patentInfo.getId(), patentInfo.gettPartRankList(), "14");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("专利信息编辑成功！");
            }
            LOG.info("专利信息编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("专利信息编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 编辑技艺革新信息
     *
     * @param tecInnovInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTTecInnovInfo")
    @ResponseBody
    public ResultData updateTTecInnovInfo(@RequestBody TTecInnovInfo tecInnovInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑技艺革新信息
            int flag = draftsService.updateTTecInnovInfo(tecInnovInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(tecInnovInfo.getId(), tecInnovInfo.gettPartRankList(), "15");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("技艺革新信息编辑成功！");
            }
            LOG.info("技艺革新信息编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("技艺革新信息编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/updateTContestInfo")
    @ResponseBody
    public ResultData updateTContestInfo(TContestInfo contestInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑竞赛考试信息
            int flag = draftsService.updateTContestInfo(contestInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("竞赛考试信息编辑成功！");
            }
            LOG.info("竞赛考试信息编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("竞赛考试信息编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 科技管理及创新成果编辑
     *
     * @param tecManInnov
     * @param request
     * @return
     */
    @RequestMapping("/updateTTecManInnov")
    @ResponseBody
    public ResultData updateTTecManInnov(@RequestBody TTecManInnov tecManInnov, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑科技管理及创新成果
            int flag = draftsService.updateTTecManInnov(tecManInnov, user);
            //参与人员修改
            draftsService.updatePartRankData(tecManInnov.getId(), tecManInnov.gettPartRankList(), "16");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("科技管理及创新成果编辑成功！");
            }
            LOG.info("科技管理及创新成果编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("科技管理及创新成果编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 个人荣誉编辑
     *
     * @param honorInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTHonorInfo")
    @ResponseBody
    public ResultData updateTHonorInfo(THonorInfo honorInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑个人荣誉
            int flag = draftsService.updateTHonorInfo(honorInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("个人荣誉编辑成功！");
            }
            LOG.info("个人荣誉编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("个人荣誉编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 项目课题成果编辑
     *
     * @param projAchieveInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTProjAchieveInfo")
    @ResponseBody
    public ResultData updateTProjAchieveInfo(@RequestBody TProjAchieveInfo projAchieveInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑项目课题成果
            int flag = draftsService.updateTProjAchieveInfo(projAchieveInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(projAchieveInfo.getId(), projAchieveInfo.gettPartRankList(), "17");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("项目课题成果编辑成功！");
            }
            LOG.info("项目课题成果编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("项目课题成果编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 导师带徒编辑
     *
     * @param sdtTutorPrentInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTSdtTutorPrentInfo")
    @ResponseBody
    public ResultData updateTSdtTutorPrentInfo(@RequestBody TSdtTutorPrentInfo sdtTutorPrentInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑导师带徒
            int flag = draftsService.updateTSdtTutorPrentInfo(sdtTutorPrentInfo, user);

            List<TSdtPrentInfo> prents = sdtTutorPrentInfo.gettSdtPrentInfo();
            //先删除徒弟所获奖项信息
            List<TSdtPrentInfo> prentInfos = draftsService.getTSdtPrentInfoListById(sdtTutorPrentInfo.getId());
            if (prentInfos != null && prentInfos.size() > 0) {
                prentInfos.forEach(p -> {
                    draftsService.deleteTSdtAwardBySdtTdId(p.getId());
                });
            }
            //再删除徒弟信息
            draftsService.deleteTSdtPrentInfoByCondition(null, sdtTutorPrentInfo.getId());
//		            List<TSdtPrentInfo> prentList = sdtTutorPrentInfo.gettSdtPrentInfo();
            // 管理员修改时只是修改，先将原徒弟信息和徒弟所获奖项删除，然后再新增
            if (prents.size() > 0) {
                prents.forEach(p -> {
                    p.setId(IdGen.uuid());
                    p.setSdtId(sdtTutorPrentInfo.getId());
                    p.setCreaterId(user.getFax());
                    p.setCreaterName(user.getName());
                    p.setDelSign(0);
                    draftsService.addSdtPrentInfo(p);
                    List<TSdtAward> tSdtAwards = p.gettSdtAwardList();
                    if (tSdtAwards != null && tSdtAwards.size() > 0) {
                        tSdtAwards.forEach(t -> {
                            t.setId(IdGen.uuid());
                            t.setSdtTdId(p.getId());
                            t.setCreaterId(user.getFax());
                            t.setCreaterName(user.getName());
                            t.setUpdaterId(user.getFax());
                            t.setUpdaterName(user.getName());
                            draftsService.addSdtAwardInfo(t);
                        });
                    }
                });
            }
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("导师带徒编辑成功！");
            }
            LOG.info("导师带徒编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("导师带徒编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 工作经历编辑
     *
     * @param workExpInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTWorkExpInfo")
    @ResponseBody
    public ResultData updateTWorkExpInfo(TWorkExpInfo workExpInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑工作经历
            int flag = draftsService.updateTWorkExpInfo(workExpInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("工作经历编辑成功！");
            }
            LOG.info("工作经历编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("工作经历编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 挂职轮岗编辑
     *
     * @param rotationInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTRotationInfo")
    @ResponseBody
    public ResultData updateTRotationInfo(@RequestBody TRotationInfo rotationInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑挂职轮岗
            int flag = draftsService.updateTRotationInfo(rotationInfo, user);
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("挂职轮岗编辑成功！");
            }
            LOG.info("挂职轮岗编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("挂职轮岗编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 草稿箱删除接口
     *
     * @param businessId
     * @param tabName
     * @param request
     * @return
     */
    @RequestMapping("/deleteMes")
    @ResponseBody
    public ResultData deleteMes(String businessId, String tabName, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            if (!tabName.endsWith("_drafts")) {
                tabName += "_drafts";
            }
            //删除草稿箱业务数据
            draftsService.deleteMes(businessId, tabName);
            rs.setData("删除草稿箱业务数据成功！");
            LOG.info("删除草稿箱业务数据成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("删除草稿箱业务数据失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 查询个人资料完整度
     *
     * @return
     */
    @RequestMapping("/integrityAnalysis")
    @ResponseBody
    public ResultData integrityAnalysis(HttpServletRequest request, String erpNo) {
        ResultData rs = new ResultData();
        try {
//				User user = this.getLoginUserInfo(request);
            List<TMouldInfo> list = userInfoService.getMouldInfoList(null);
            User user = this.getLoginUserInfo(request);
            if (user == null) {
                rs.setSuccess(false);
                rs.setErrorMsg("获取当前登录人信息失败，请重新登录");
                return rs;
            }
            Map<String, Long> map = draftsService.integrityAnalysis(list, erpNo);
            if ("10342674".equals(user.getBaseOrgId())) {
                TMouldInfo t = new TMouldInfo();
                t.setMouldName("t_growth_plan");
                Page<TGrowthPlan> page = new Page<TGrowthPlan>();
                page.setPageNo(1);
                page.setPageSize(1000);
                userInfoService.getPersonalPageGrowthPlanByErpNo(page, user.getFax());
                if (page != null) {
                    t.setModuleCount(page.getResult().size());
                } else {
                    t.setModuleCount(0);
                }
                map.put("t_growth_plan", t.getModuleCount().longValue());
            }
            rs.setData(map);
            LOG.info("完整度查询成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("完整度查询失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 获取个人草稿箱列表数据
     *
     * @param request
     * @param draftsList
     * @return
     */
    @RequestMapping("/getDraftsListPage")
    @ResponseBody
    public ResultData getDraftsListPage(HttpServletRequest request, Page<DraftsListVo> page) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            draftsService.getDraftsListPage(page, user.getFax());
            rs.setData(page);
            LOG.info("获取草稿箱列表成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("获取草稿箱列表失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 添加草稿箱列表数据
     *
     * @param request
     * @param draftsList
     * @return
     */
    @RequestMapping("/addDraftsList")
    @ResponseBody
    public ResultData addDraftsList(HttpServletRequest request, DraftsListVo draftsList) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            draftsService.addDraftsList(draftsList, user);
            rs.setData("添加到草稿箱列表成功！");
            LOG.info("添加到草稿箱列表成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("添加到草稿箱列表失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 查找草稿箱分类及数量接口
     *
     * @param request
     * @param erpNo
     * @return
     */
    @RequestMapping("/getAllDraftsTypeAndCount")
    @ResponseBody
    public ResultData getAllDraftsTypeAndCount(HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            List<TMouldInfo> list = userInfoService.getMouldInfoList(null);
            if (user == null) {
                rs.setSuccess(false);
                rs.setErrorMsg("获取当前登录人信息失败，请重新登录");
                return rs;
            }
            Map<String, Long> map = draftsService.getAllDraftsTypeAndCount(list, user.getFax());
            if ("10342674".equals(user.getBaseOrgId())) {
                TMouldInfo t = new TMouldInfo();
                Page<TGrowthPlan> page = new Page<TGrowthPlan>();
                page.setPageNo(1);
                page.setPageSize(1000);
                draftsService.getPersonalPageGrowthPlanByErpNo(page, user.getFax());
                if (page != null && page.getResult().size() > 0) {
                    t.setModuleCount(page.getResult().size());
                    map.put("t_growth_plan_drafts", t.getModuleCount().longValue());
                }
            }
            rs.setData(map);
            LOG.info("草稿箱分类及数量查询成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("草稿箱分类及数量查询失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 近三年业绩查询
     *
     * @param request
     * @param erpNo
     * @return
     */
    @RequestMapping("/personalLastThreeYearHonor")
    @ResponseBody
    public ResultData personalLastThreeYearHonor(HttpServletRequest request, String erpNo) {
        ResultData rs = new ResultData();
//			User user = this.getLoginUserInfo(request);
        try {
//				if(user!=null) {
//					String erpNo=user.getFax();
//					if(StringUtil.isNullOrEmpty(erpNo)) {
//						rs.setSuccess(false);
//						rs.setData("erp编号获取失败！");
//						return rs;
//					}
//				}
            Map<Integer, Map<String, Long>> map = new HashMap<Integer, Map<String, Long>>();
            Date date = new Date();
            int oneYear = date.getYear() + 1900;
            int twoYear = date.getYear() + 1900 - 1;
            int threeYear = date.getYear() + 1900 - 2;
            List<TMouldInfo> list = userInfoService.getMouldInfoList(null);
            Map<String, Long> oneP = draftsService.personalLastThreeYearHonor(list, erpNo, oneYear);
            Map<String, Long> twoP = draftsService.personalLastThreeYearHonor(list, erpNo, twoYear);
            Map<String, Long> threeP = draftsService.personalLastThreeYearHonor(list, erpNo, threeYear);
            map.put(threeYear, threeP);
            map.put(twoYear, twoP);
            map.put(oneYear, oneP);
            rs.setData(map);
            LOG.info("近三年业绩查询成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("近三年业绩查询失败！");
            e.printStackTrace();
        }
        return rs;
    }


    @RequestMapping("/getGrowthTreeByErpNo")
    @ResponseBody
    public ResultData getGrowthTreeByErpNo(HttpServletRequest request, String erpNo) {
        ResultData rs = new ResultData();
//			User user = this.getLoginUserInfo(request);
        try {
            Map<String, CommonVo> map = new HashMap<String, CommonVo>();
            CommonVo commonVoOne = draftsService.getGrowthTreeJndjByErpNo(erpNo);//获取技能等级
            CommonVo commonVoTwo = draftsService.getGrowthTreeZjrcchByErpNo(erpNo);//获取专家人才称号
            CommonVo commonVoThree = draftsService.getGrowthTreeZyzjByErpNo(erpNo);//获取职员职级
            CommonVo commonVoFour = draftsService.getGrowthTreeZwByErpNo(erpNo);//获取职务
            CommonVo commonVoFive = draftsService.getGrowthTreeZcByErpNo(erpNo);//获取职称（专业技术资格）
            map.put("t_skill_level_info", commonVoOne);
            map.put("t_expert_title_info", commonVoTwo);
            map.put("t_pos_zhij", commonVoThree);
            map.put("t_pos_rel", commonVoFour);
            map.put("t_pro_tec_info", commonVoFive);
            rs.setData(map);
            LOG.info("员工成长树查询成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("员工成长树查询失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 添加员工成长计划
     *
     * @param tGrowthPlan
     * @param request
     * @return
     */
    @RequestMapping("/addGrowthPlan")
    @ResponseBody
    public ResultData addGrowthPlan(@RequestBody TGrowthPlan tGrowthPlan, HttpServletRequest request) {
        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            // 添加token传参
//				tGrowthPlan.setToken(this.getToken(request));
            if (!"其它".equals((tGrowthPlan.getFuturePost()))) {
                tGrowthPlan.setOtherCase(null);
            }
            List<TDeptEmpRela> depts = deptErpRelaService.getDeptInfoByErpNo(tGrowthPlan.getErpNo());
            if (depts != null && depts.size() > 0) {
                DeptIdPathVo path = userInfoService.getDeptIdPathById(depts.get(0).getDeptId());
                if (path != null) {
                    String pathString = path.getPath().replace("|", "-");
                    tGrowthPlan.setDeptId(pathString);
                }
            }
            Map<String, Object> map = GetFullDeptByErpNoUtil.getOrgDeptList();
            tGrowthPlan.setDeptName(GetFullDeptByErpNoUtil.getFullDept(map, tGrowthPlan.getErpNo()));//获取部门全路径
            draftsService.addGrowthPlan(tGrowthPlan, user);
            rs.setData("员工成长计划保存草稿箱成功！");
            LOG.info("员工成长计划保存草稿箱成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("员工成长计划保存草稿箱失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 分页查找个人员工成长计划列表
     *
     * @param page
     * @param erpNo
     * @return
     */
    @RequestMapping("/getPersonalPageGrowthPlanByErpNo")
    @ResponseBody
    public ResultData getPersonalPageGrowthPlanByErpNo(Page<TGrowthPlan> page, String erpNo) {
        ResultData rs = new ResultData();
        try {
            draftsService.getPersonalPageGrowthPlanByErpNo(page, erpNo);
            rs.setData(page);
            LOG.info("查找个人员工成长计划成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人员工成长计划失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 根据Id查找员工成长计划详情
     *
     * @param id
     * @return
     */
    @RequestMapping("/getGrowthPlanById")
    @ResponseBody
    public ResultData getGrowthPlanById(String id) {
        ResultData rs = new ResultData();
        try {
            rs.setData(draftsService.getGrowthPlanById(id));
            LOG.info("查找员工成长计划成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找员工成长计划失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 编辑员工成长计划
     *
     * @param tGrowthPlan
     * @param request
     * @return
     */
    @RequestMapping("/updateGrowthPlan")
    @ResponseBody
    public ResultData updateGrowthPlan(@RequestBody TGrowthPlan tGrowthPlan, HttpServletRequest request) {

        ResultData rs = new ResultData();
        User user = this.getLoginUserInfo(request);
        try {
            // 添加token传参
//	   			tGrowthPlan.setToken(this.getToken(request));
            if (!"其它".equals((tGrowthPlan.getFuturePost()))) {
                tGrowthPlan.setOtherCase(null);
            }
            List<TDeptEmpRela> depts = deptErpRelaService.getDeptInfoByErpNo(tGrowthPlan.getErpNo());
            if (depts != null && depts.size() > 0) {
                DeptIdPathVo path = userInfoService.getDeptIdPathById(depts.get(0).getDeptId());
                if (path != null) {
                    String pathString = path.getPath().replace("|", "-");
                    tGrowthPlan.setDeptId(pathString);
                }
            }
            Map<String, Object> map = GetFullDeptByErpNoUtil.getOrgDeptList();
            tGrowthPlan.setDeptName(GetFullDeptByErpNoUtil.getFullDept(map, tGrowthPlan.getErpNo()));//获取部门全路径
            draftsService.updateGrowthPlan(tGrowthPlan, user);
            rs.setData("员工成长计划更新成功！");
            LOG.info("员工成长计划更新成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("员工成长计划更新失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
     * 新增员工员工流动
     * @param employeeMobility
     * @return
     */
    @PostMapping("/addEmployeeMobility")
    @ResponseBody
    public ResultData addEmployeeMobility(@RequestBody TEmployeeMobility employeeMobility, HttpServletRequest request){
        draftsService.addEmployeeMobility(employeeMobility,this.getLoginUserInfo(request));
        return ResultData.success();
    }



    /**
     * id查找员工流动信息
     * @param employeeMobility
     * @return
     */
    @GetMapping("/getEmployeeMobilityById")
    @ResponseBody
    public ResultData getEmployeeMobilityById(String id){
        return ResultData.success(draftsService.getEmployeeMobilityById(id));
    }

    /**
     * 分页查找员工流动信息
     * @param employeeMobility
     * @return
     */
    @PostMapping("/getPageEmployeeMobility")
    @ResponseBody
    public ResultData getPageEmployeeMobility(Page<TEmployeeMobility> page, @RequestBody TEmployeeMobility employeeMobility) {
        ResultData rs = checkErpNoIsNull(employeeMobility.getErpNo());
        if (!rs.isSuccess()) {
            return rs;
        }
        draftsService.findPageEmployeeMobilityByCondi(page, employeeMobility);
        rs.setData(page);
        LOG.info("查找员工流动信息成功");
        return rs;
    }

    /**
     * 编辑员工流动信息
     *
     * @param employeeMobility
     * @param request
     * @return
     */
    @PostMapping("/updateEmployeeMobility")
    @ResponseBody
    public ResultData updateEmployeeMobility(@RequestBody TEmployeeMobility employeeMobility) {
        draftsService.updateEmployeeMobility(employeeMobility);
        return ResultData.success();

    }


    /**
     * 分页查找技术标准信息
     * @param tecStandardInfo
     * @return
     */
    @PostMapping("/getPageTecStandardInfo")
    @ResponseBody
    public ResultData getPageTecStandardInfo(Page<TTecStandardInfo> page, @RequestBody TTecStandardInfo tecStandardInfo) {
        ResultData rs = new ResultData();
        if (!tecStandardInfo.gettPartRankList().isEmpty()) {
            rs = checkErpNoIsNull(tecStandardInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            draftsService.findPageTecStandardInfoByCondi(page, tecStandardInfo);
            if (!page.getResult().isEmpty()) {
                page.getResult().forEach(p -> {
                    p.setStandardTypeStr(SysDictionaryUtil.getNameByValueForDefault("tecStandardType", p.getStandardType()));
                });
            }
            rs.setData(page);
            LOG.info("查找技术标准成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技术标准失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 新增技术标准
     * @param tecStandardInfo
     * @return
     */
    @PostMapping("/addTecStandardInfo")
    @ResponseBody
    public ResultData addTecStandardInfo(@RequestBody TTecStandardInfo tecStandardInfo, HttpServletRequest request){
        draftsService.addTecStandardInfo(tecStandardInfo,this.getLoginUserInfo(request));
        return ResultData.success();
    }

    @RequestMapping("/getTecStandardInfoById")
    @ResponseBody
    public ResultData getTecStandardInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            TTecStandardInfo tecStandardInfoVo = draftsService.getTecStandardInfoById(id);
            rs.setData(tecStandardInfoVo);
            LOG.info("查找技术标准信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技术标准信息失败！");
            e.printStackTrace();
        }
        return rs;
    }

    /**
     * 编辑技术标准
     *
     * @param tecStandardInfo
     * @param request
     * @return
     */
    @RequestMapping("/updateTecStandardInfo")
    @ResponseBody
    public ResultData updateTecStandardInfo(@RequestBody TTecStandardInfo tecStandardInfo, HttpServletRequest request) {
        ResultData rs = new ResultData();
        try {
            User user = this.getLoginUserInfo(request);
            //编辑学术成果
            int flag = draftsService.updateTecStandardInfo(tecStandardInfo, user);
            //参与人员修改
            draftsService.updatePartRankData(tecStandardInfo.getId(), tecStandardInfo.gettPartRankList(), "21");
            if (flag == 0) {
                rs.setSuccess(false);
                rs.setErrorMsg("该数据已在草稿箱内被删除，请返回后重新添加！");
            } else {
                rs.setData("技术标准编辑成功！");
            }
            LOG.info("技术标准编辑成功！");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("技术标准编辑失败！");
            e.printStackTrace();
        }
        return rs;
    }
}
